eeeb0570f127e0950c4696ccb12fb1287cbf5515,voipms-sms/src/main/java/net/kourlas/voipms_sms/Database.java,CustomAsyncTask,doInBackground,#number#,611
Before Change
}
return true;
}
for (Object rawSmsObj : rawMessages) {
JSONObject rawSms = (JSONObject) rawSmsObj;
if (rawSms == null || rawSms.get("id") == null || rawSms.get("date") == null ||
rawSms.get("type") == null || rawSms.get("did") == null || rawSms.get("contact") == null ||
rawSms.get("message") == null || !(rawSms.get("id") instanceof String) ||
!(rawSms.get("date") instanceof String) || !(rawSms.get("type") instanceof String) ||
!(rawSms.get("did") instanceof String) || !(rawSms.get("contact") instanceof String) ||
!(rawSms.get("message") instanceof String)) {
if (showErrors) {
Toast.makeText(applicationContext, applicationContext.getString(
R.string.database_sync_error_api_parse), Toast.LENGTH_SHORT).show();
}
return true;
}
String id = (String) rawSms.get("id");
String date = (String) rawSms.get("date");
String type = (String) rawSms.get("type");
String did = (String) rawSms.get("did");
String contact = (String) rawSms.get("contact");
String message = (String) rawSms.get("message");
try {
Message sms = new Message(id, date, type, did, contact, message);
serverMessages.add(sms);
After Change
}
return true;
}
for (int i = 0; i < rawMessages.length(); i++) {
JSONObject rawSms = rawMessages.optJSONObject(i);
if (rawSms == null || rawSms.optString("id") == null || rawSms.optString("date") == null ||
rawSms.optString("type") == null || rawSms.optString("did") == null ||
rawSms.optString("contact") == null || rawSms.optString("message") == null) {
if (showErrors) {
Toast.makeText(applicationContext, applicationContext.getString(
R.string.database_sync_error_api_parse), Toast.LENGTH_SHORT).show();
}
return true;
}
String id = rawSms.optString("id");
String date = rawSms.optString("date");
String type = rawSms.optString("type");
String did = rawSms.optString("did");
String contact = rawSms.optString("contact");
String message = rawSms.optString("message");
try {
Message sms = new Message(id, date, type, did, contact, message);
serverMessages.add(sms);